﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iOak.Domain.Campaigns;
using iOak.Data.Campaigns;

namespace iOak.Business.Campaigns
{
    public class ApplicationCandidateService
    {
        private ApplicationCandidatesRepository _applicationCandidateRepository;
        public ApplicationCandidateService()
        {
            _applicationCandidateRepository = new ApplicationCandidatesRepository("master");
        }

        public List<ApplicationCandidate> LoadAll()
        {
            return _applicationCandidateRepository.LoadAll();
        }

        public void Create(ApplicationCandidate applicationCandidate)
        {
            _applicationCandidateRepository.Create(applicationCandidate);
        }

        public ApplicationCandidate Retrieve(Guid applicationCandidateId)
        {
            return _applicationCandidateRepository.Retrieve(applicationCandidateId);
        }

        public void Update(ApplicationCandidate applicationCandidate)
        {
            _applicationCandidateRepository.Update(applicationCandidate);
        }

        public void Delete(Guid applicationCandidateId)
        {
            _applicationCandidateRepository.Delete(applicationCandidateId);
        }

        public int GetCount(Guid? campaignId = null, Guid? applicationId = null, bool? passed = null, bool includeOpen = true)
        {
            return _applicationCandidateRepository.GetCount(campaignId, applicationId, passed, includeOpen);
        }

        public List<ApplicationCandidate> GetListByApplicationId(Guid applicationId)
        {
            return _applicationCandidateRepository.GetListByApplicationId(applicationId);
        }

        public List<ApplicationCandidate> GetPassedListByApplicationId(Guid applicationId, bool blPass = false)
        {
            return _applicationCandidateRepository.GetPassedListByApplicationId(applicationId, blPass);
        }

        public List<ApplicationCandidate> GetListByCompanyId(Guid companyId)
        {
            return _applicationCandidateRepository.GetListByCompanyId(companyId);
        }

        public List<ApplicationCandidate> GetListByCheckedBy(Guid checkedBy)
        {
            return _applicationCandidateRepository.GetListByCheckedBy(checkedBy);
        }

        public ApplicationCandidate GetByResumeId(Guid resumeId)
        {
            return _applicationCandidateRepository.GetByResumeId(resumeId);
        }

        public bool AllPassed(Guid applicationId) 
        {
            return _applicationCandidateRepository.AllPassed(applicationId);
        }

        public List<ApplicationCandidate> GetUnPassedList(Guid companyId) 
        {
            return _applicationCandidateRepository.GetUnPassedList(companyId);
        }
    }
}
